package com.atguigu.yygh.cmn.excel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.atguigu.yygh.model.cmn.Dict;

import java.util.ArrayList;
import java.util.List;

/*==========================================
      时 间:   2022-03-04
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
public class ExcelWriteDemo {



    //Excel写出操作
    public static void main(String[] args) {
        List<Student> students=new ArrayList<Student>();

        students.add(new Student(1,"晏子龙",20,true));
        students.add(new Student(2,"浩浩",20,true));
        students.add(new Student(3,"小浩浩",1,true));
        /**
         * workbook:工作簿
         *   sheet:工作表
         *     row：行
         *      cell:单元格
         */
        EasyExcel.write("C:\\Users\\LH\\Desktop\\abc.xlsx", Student.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("学生列表").doWrite(students);
    }
}
